<template>
    <div>
<city-header></city-header>
<city-search :cities="cities"></city-search>
<city-list :hotcitys="hotcitys" :cities="cities" :letter="letter" ></city-list>
<city-alphabet :cities="cities" @change="alphabetclick"></city-alphabet>
    </div>
</template>

<script>
     import axios from 'axios'
    import CityHeader from './components/header'
    import CitySearch from './components/search'
    import CityList from './components/list'
    import CityAlphabet from './components/alphabet'
    export default {
        name:"City",
        components:{
            CityHeader,
            CitySearch,
            CityList,
            CityAlphabet,
        },
        data(){
         return{
             hotcitys:[],
             cities:{},
             letter:'',
             
         }


        },
        methods: {
       alphabetclick(letter){
       this.letter=letter
    },        
    getHomeInfo() {
      axios({
        url:"https://www.easy-mock.com/mock/5b46b28a6c716f5074cd9e04/index",
        methods:'get'
      })

        .then(this.getHomeInfoSucc);
    },
    getHomeInfoSucc(res) {
      res = res.data;
      console.log(res)
       
      if (res.ret && res.data) {
        const data = res.data;
        this.hotcitys = data.hotcitys;
         this.cities = data.cities;
        
      }
    }
  },
  mounted() {
    this.getHomeInfo();
  }
        
    
    }
</script>

<style lang="stylus" scoped>

</style>